﻿using Microsoft.EntityFrameworkCore.Migrations;
using System;

namespace duia.Canteenpay.Repository.Migrations
{
    public partial class _100 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "canpay_dishes_category",
                columns: table => new
                {
                    KeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    Name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 283, DateTimeKind.Local).AddTicks(2886)),
                    CreateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    CreateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 283, DateTimeKind.Local).AddTicks(4818)),
                    UpdateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: true),
                    UpdateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    IsDelete = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_canpay_dishes_category", x => x.KeyId);
                });

            migrationBuilder.CreateTable(
                name: "canpay_users",
                columns: table => new
                {
                    KeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    UserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
                    UserPassWord = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false),
                    Account = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 236, DateTimeKind.Local).AddTicks(2764)),
                    CreateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    CreateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 244, DateTimeKind.Local).AddTicks(2157)),
                    UpdateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: true),
                    UpdateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    IsDelete = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_canpay_users", x => x.KeyId);
                });

            migrationBuilder.CreateTable(
                name: "canpay_dishes",
                columns: table => new
                {
                    KeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    DishesName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
                    DishesCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
                    DishesCategoryKeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false, defaultValue: 0m),
                    ShowImageUrl = table.Column<string>(type: "longtext", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 285, DateTimeKind.Local).AddTicks(4967)),
                    CreateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: false),
                    CreateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, defaultValue: new DateTime(2020, 12, 18, 16, 44, 33, 285, DateTimeKind.Local).AddTicks(6427)),
                    UpdateUserKeyId = table.Column<Guid>(type: "char(36)", nullable: true),
                    UpdateUserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
                    IsDelete = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_canpay_dishes", x => x.KeyId);
                    table.ForeignKey(
                        name: "FK_canpay_dishes_canpay_dishes_category_DishesCategoryKeyId",
                        column: x => x.DishesCategoryKeyId,
                        principalTable: "canpay_dishes_category",
                        principalColumn: "KeyId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "canpay_dishes_category",
                columns: new[] { "KeyId", "CreateTime", "CreateUserKeyId", "CreateUserName", "Name", "UpdateUserKeyId", "UpdateUserName" },
                values: new object[] { new Guid("09f0d3c7-40fe-11eb-8fac-5254000e3ad6"), new DateTime(2020, 12, 18, 16, 44, 33, 283, DateTimeKind.Local).AddTicks(6), new Guid("00000000-0000-0000-0000-000000000000"), null, "荤菜", null, null });

            migrationBuilder.InsertData(
                table: "canpay_users",
                columns: new[] { "KeyId", "Account", "CreateTime", "CreateUserKeyId", "CreateUserName", "UpdateUserKeyId", "UpdateUserName", "UserName", "UserPassWord" },
                values: new object[] { new Guid("0f20b0d3-4be3-4dc6-9e8a-fc73ef680c1f"), "admin", new DateTime(2020, 12, 18, 16, 44, 33, 232, DateTimeKind.Local).AddTicks(5381), new Guid("00000000-0000-0000-0000-000000000000"), null, null, null, "admin", "123456" });

            migrationBuilder.InsertData(
                table: "canpay_dishes",
                columns: new[] { "KeyId", "CreateTime", "CreateUserKeyId", "CreateUserName", "DishesCategoryKeyId", "DishesCode", "DishesName", "ShowImageUrl", "UpdateUserKeyId", "UpdateUserName" },
                values: new object[] { new Guid("f5284feb-d182-4538-9b38-17cdb5850b56"), new DateTime(2020, 12, 18, 16, 44, 33, 285, DateTimeKind.Local).AddTicks(2732), new Guid("00000000-0000-0000-0000-000000000000"), null, new Guid("09f0d3c7-40fe-11eb-8fac-5254000e3ad6"), "CS1000", "土豆炒猪肉", null, null, null });

            migrationBuilder.CreateIndex(
                name: "IX_canpay_dishes_DishesCategoryKeyId",
                table: "canpay_dishes",
                column: "DishesCategoryKeyId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "canpay_dishes");

            migrationBuilder.DropTable(
                name: "canpay_users");

            migrationBuilder.DropTable(
                name: "canpay_dishes_category");
        }
    }
}
